package org.budo.spring.velocity.view;

import org.apache.velocity.Template;
import org.apache.velocity.app.VelocityEngine;
import org.springframework.web.servlet.view.velocity.VelocityLayoutView;

/**
 * @author limingwei
 */
@SuppressWarnings("deprecation")
public class BudoVelocityLayoutView extends VelocityLayoutView {
    @Override
    protected Template getTemplate() throws Exception {
        return super.getTemplate();
    }

    @Override
    protected Template getTemplate(String name) throws Exception {
        String encoding = this.getEncoding();
        VelocityEngine velocityEngine = this.getVelocityEngine();

        if (null != encoding) {
            return velocityEngine.getTemplate(name, encoding);
        }

        return velocityEngine.getTemplate(name);
    }
}